﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using EnhancedWebControls;

namespace EwcControlTest
{
    public partial class NavBars : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            this.NavigationBar1.EnableViewState = false;
            if (!Page.IsPostBack)
            {
                this.NavigationBar1.DataSource = GetMenuItems();
                this.NavigationBar2.DataSource = GetMenuItems();
                this.NavigationBar1.DataBind();
                this.NavigationBar2.DataBind();
            }
        }
        public static List<NavBarMenuItem> GetMenuItems()
        {
            List<NavBarMenuItem> rval = new List<NavBarMenuItem>();
            rval.Add(new NavBarMenuItem { MenuID = 1, ParentID = 0, MenuText = "Home", MenuDescription = "Default Page", NavigateUrl = "#Default.aspx", HideInMenu = false, OpenInNewWindow = false });
            rval.Add(new NavBarMenuItem { MenuID = 10, ParentID = 0, MenuText = "NavBars", MenuDescription = "Test the NavBar Control", NavigateUrl = "#NavBars", HideInMenu = false, OpenInNewWindow = false });
            rval.Add(new NavBarMenuItem { MenuID = 2, ParentID = 0, MenuText = "Labeled Inputs", MenuDescription = "Test the Labeled Input Controls", NavigateUrl = null, HideInMenu = false, OpenInNewWindow = false });
            rval.Add(new NavBarMenuItem { MenuID = 3, ParentID = 2, MenuText = "EnhancedTextBox", MenuDescription = "Test the Enhanced Text Box Control", NavigateUrl = "#EnhancedTextBox", HideInMenu = false, OpenInNewWindow = false });
            rval.Add(new NavBarMenuItem { MenuID = 4, ParentID = 2, MenuText = "EnhancedDropDown", MenuDescription = "Test the Enhanced Drop Down Control", NavigateUrl = "#EnhancedDropDown", HideInMenu = false, OpenInNewWindow = false });
            rval.Add(new NavBarMenuItem { MenuID = 5, ParentID = 2, MenuText = "EnhancedCheckBox", MenuDescription = "Test the Enhanced Check Box Control", NavigateUrl = "#EnhancedCheckBox", HideInMenu = false, OpenInNewWindow = false });
            rval.Add(new NavBarMenuItem { MenuID = 6, ParentID = 2, MenuText = "EnhancedCalendar", MenuDescription = "Test the Enhanced Calendar Control", NavigateUrl = "#EnhancedCalendar", HideInMenu = false, OpenInNewWindow = false });
            rval.Add(new NavBarMenuItem { MenuID = 7, ParentID = 0, MenuText = "Buttons", MenuDescription = "Test the Enhanced Buttons", NavigateUrl = null, HideInMenu = false, OpenInNewWindow = false });
            rval.Add(new NavBarMenuItem { MenuID = 8, ParentID = 7, MenuText = "EnhancedButton", MenuDescription = "Test the Enhanced Button", NavigateUrl = "#EnhancedButton", HideInMenu = false, OpenInNewWindow = false });
            rval.Add(new NavBarMenuItem { MenuID = 9, ParentID = 7, MenuText = "EnhancedLinkButton", MenuDescription = "Test the Enhanced Link Button", NavigateUrl = "#EnhancedLinkButton", HideInMenu = false, OpenInNewWindow = false });
            rval.Add(new NavBarMenuItem { MenuID = 15, ParentID = 0, MenuText = "Panels & Popups", MenuDescription = "Test Panels and Popups", NavigateUrl = null, HideInMenu = false, OpenInNewWindow = false });
            rval.Add(new NavBarMenuItem { MenuID = 11, ParentID = 15, MenuText = "MessageBox", MenuDescription = "Test the MessageBox Control", NavigateUrl = "#MessageBox", HideInMenu = false, OpenInNewWindow = false });
            rval.Add(new NavBarMenuItem { MenuID = 12, ParentID = 15, MenuText = "CustomMessagePanel", MenuDescription = "Test the CustomMessagePanel Control", NavigateUrl = "#CustomMessagePanel", HideInMenu = false, OpenInNewWindow = false });
            rval.Add(new NavBarMenuItem { MenuID = 13, ParentID = 15, MenuText = "PopUpPanel", MenuDescription = "Test the PopUpPanel Control", NavigateUrl = "#PopUpPanel", HideInMenu = false, OpenInNewWindow = false });
            rval.Add(new NavBarMenuItem { MenuID = 14, ParentID = 15, MenuText = "ModalProgressPanels", MenuDescription = "Test the ModalProgressPanel Control", NavigateUrl = "#ModalProgressPanels", HideInMenu = false, OpenInNewWindow = false });
            return rval;
        }

        protected void NavigationBar2_NavBarClicked(NavBarClickArgs clickArgs)
        {
            lblResults1.Text = "You clicked a menu item: <br/>";
            lblResults1.Text += "Clicked Item Menu Id: " + clickArgs.ClickedItemMenuID.ToString() + "<br/>";
            lblResults1.Text += "Clicked Item Parent Id: " + clickArgs.ClickedItemParentID.ToString() + "<br/>";
            lblResults1.Text += "Navigate Url: " + clickArgs.NavigateUrl + "<br/>";
            lblResults1.Visible = true;
        }
    }
}
